package com.wys.singleton_demo.hungry;

/**
 * @author godShan
 * @Description: 饿汉式单例
 * @date 2019/5/5 11:05
 */
//优点 线程安全
//缺点 会消耗内存 不管是否使用初始化就创建出了对象
public class HungrySingleton2 {

    private static final HungrySingleton2 INSTANCE;

    static {
        INSTANCE = new HungrySingleton2();
    }

    private HungrySingleton2() {}

    public static HungrySingleton2 getInstance() {
        return INSTANCE;
    }

}
